<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <script src="https://unpkg.com/react@^16/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/react-dom@16.13.0/umd/react-dom.production.min.js"></script>
    <script src="https://unpkg.com/babel-standalone@6.26.0/babel.js"></script>
    <script type="text/babel">
      class Login extends React.Component {
        constructor(props) {
          super(props)
          this.state = {
            val: '',
            ischeck: true,
            selval: '',
            Avalue: ''
          }
          this.hchange = this.hchange.bind(this)
        }
        hchange(e) {
          console.log(e.target.value) //获取输入框的值
          this.setState({
            val: e.target.value
          })
        }
        selChange = e => {
          console.log(e.target)
          this.setState({
            Avalue: e.target.value
          })
        }
        render() {
          return (
            <div>
              <form>
                <input
                  type="text"
                  value={this.state.val}
                  onChange={this.hchange}
                />
                <div>{this.state.val}</div>
                <select value={this.state.Avalue} onChange={this.selChange}>
                  <option value="grapefruit">葡萄柚</option>
                  <option value="lime">酸橙</option>
                  <option value="coconut">椰子</option>
                  <option value="mango">芒果</option>
                </select>
                <h1>{this.state.Avalue}</h1>
              </form>
            </div>
          )
        }
      }
      ReactDOM.render(<Login />, document.getElementById('app'))
    </script>
  </body>
</html>
